import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: () => import('@/views/admin/Layout.vue'),
    redirect: '/home',
    children: [
      { path: 'profile', component: () => import('@/views/admin/Profile.vue') },
      {
        path: 'password',
        component: () => import('@/views/admin/Password.vue')
      },
      { path: 'home', component: () => import('@/views/admin/Home.vue') },
      { path: 'user', component: () => import('@/views/admin/User.vue') }
    ]
  },
  { path: '/login', component: () => import('@/views/Login.vue') },
  { path: '/register', component: () => import('@/views/Register.vue') }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
